package org.jing.ext.jdbc.mybatis.param;

import org.jing.core.lang.ExceptionHandler;
import org.jing.core.util.DateUtil;

import java.util.Date;

public class DatetimeTypeHandler extends BaseTypeHandler<Date, String> {
    @Override
    public String handle(Object value) {
        ExceptionHandler.publishIfMatch(!(value instanceof Date), "java type must be Date");
        return DateUtil.getDateString((Date) value, DateUtil.JAVA_DATE_TIME);
    }
}
